import axios from "axios";

const service = axios.create({
  baseURL: "/api",
  timeout: 5000,
});

service.interceptors.request.use(config => {
  config.headers['Content-Type'] = 'application/json;charset=utf-8';
  let jwt = JSON.parse(sessionStorage.getItem("user")) || {};

  // 添加token
  config.headers['Authorization'] = jwt;

  return config;
},error => {
  return Promise.reject(error);
});
export default service
